package com.rmy.queue.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.rmy.common.annotation.Log;
import com.rmy.common.core.controller.BaseController;
import com.rmy.common.core.domain.AjaxResult;
import com.rmy.common.enums.BusinessType;
import com.rmy.queue.domain.QmsWindowVoic;
import com.rmy.queue.service.IQmsWindowVoicService;
import com.rmy.common.utils.poi.ExcelUtil;
import com.rmy.common.core.page.TableDataInfo;

/**
 * 窗口和语音模块关联Controller
 * 
 * @author rmy
 * @date 2022-10-12
 */
@RestController
@RequestMapping("/queue/windowvoic")
public class QmsWindowVoicController extends BaseController
{
    @Autowired
    private IQmsWindowVoicService qmsWindowVoicService;

    /**
     * 查询窗口和语音模块关联列表
     */
    @PreAuthorize("@ss.hasPermi('queue:windowvoic:list')")
    @GetMapping("/list")
    public TableDataInfo list(QmsWindowVoic qmsWindowVoic)
    {
        startPage();
        List<QmsWindowVoic> list = qmsWindowVoicService.selectQmsWindowVoicList(qmsWindowVoic);
        return getDataTable(list);
    }

    /**
     * 导出窗口和语音模块关联列表
     */
    @PreAuthorize("@ss.hasPermi('queue:windowvoic:export')")
    @Log(title = "窗口和语音模块关联", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, QmsWindowVoic qmsWindowVoic)
    {
        List<QmsWindowVoic> list = qmsWindowVoicService.selectQmsWindowVoicList(qmsWindowVoic);
        ExcelUtil<QmsWindowVoic> util = new ExcelUtil<QmsWindowVoic>(QmsWindowVoic.class);
        util.exportExcel(response, list, "窗口和语音模块关联数据");
    }

    /**
     * 获取窗口和语音模块关联详细信息
     */
    @PreAuthorize("@ss.hasPermi('queue:windowvoic:query')")
    @GetMapping(value = "/{windowId}")
    public AjaxResult getInfo(@PathVariable("windowId") Long windowId)
    {
        return AjaxResult.success(qmsWindowVoicService.selectQmsWindowVoicByWindowId(windowId));
    }

    /**
     * 新增窗口和语音模块关联
     */
    @PreAuthorize("@ss.hasPermi('queue:windowvoic:add')")
    @Log(title = "窗口和语音模块关联", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QmsWindowVoic qmsWindowVoic)
    {
        return toAjax(qmsWindowVoicService.insertQmsWindowVoic(qmsWindowVoic));
    }

    /**
     * 修改窗口和语音模块关联
     */
    @PreAuthorize("@ss.hasPermi('queue:windowvoic:edit')")
    @Log(title = "窗口和语音模块关联", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QmsWindowVoic qmsWindowVoic)
    {
        return toAjax(qmsWindowVoicService.updateQmsWindowVoic(qmsWindowVoic));
    }

    /**
     * 删除窗口和语音模块关联
     */
    @PreAuthorize("@ss.hasPermi('queue:windowvoic:remove')")
    @Log(title = "窗口和语音模块关联", businessType = BusinessType.DELETE)
	@DeleteMapping("/{windowIds}")
    public AjaxResult remove(@PathVariable Long[] windowIds)
    {
        return toAjax(qmsWindowVoicService.deleteQmsWindowVoicByWindowIds(windowIds));
    }
}
